#pragma once

/**
    @brief    Simple, fast, good random number generator (Multiply-with-carry).
            Passes the Diehard tests. Based on code from
            http://www.hxa.name/minilight/
            http://www.codeproject.com/KB/recipes/SimpleRNG.aspx            
    @author yakiimo02
    @data    2010/02/07
*/

class RandomMwc
{
public:
   RandomMwc( int seed = 0 );

   int getDword();
   float getFloat();
   inline float getFloatInRange( float fMin, float fMax );

protected:
   unsigned int seeds_m[2];
};
 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

inline float RandomMwc::getFloatInRange( float fMin, float fMax )
{
    return ( fMax-fMin ) * getFloat() + fMin;
}

extern RandomMwc    g_randomMwc;
